<template>
    <div>
        son 组件

        <hr>
        <h3> {{ money }}</h3>
        <button @click="changeMoney(1)">花 1 元</button>
    </div>
</template>
<script>
export default {
    props: {
        money: {
            type: Number,
            default: 0
        }
    },
    // props: ['money'],  //vue2
    setup (props, context) {
        console.log('props', props.money);
        console.log("context", context);
        //  消费1元   子向父组件传递值
        const changeMoney = (data) => {
            context.emit('change', data)
        }

        return {
            changeMoney
        }
    }
}
</script>